VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Stack"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim stack()

Public Sub push(X)
ReDim Preserve stack(UBound(stack) + 1)
stack(UBound(stack)) = X
End Sub

Public Function pop()
If UBound(stack) > 0 Then
    pop = stack(UBound(stack))
    ReDim Preserve stack(UBound(stack) - 1)
Else
    pop = ""
End If
End Function

Public Function popback()
If UBound(stack) = 0 Then
    popback = 0
    Exit Function
End If

End Function

Public Function peek()
If UBound(stack) > 0 Then
    peek = stack(UBound(stack))
Else
    peek = 0
End If
End Function

Property Get size() As Integer
size = UBound(stack)
End Property

Property Get isempty() As Boolean
isempty = (UBound(stack) = 0)
End Property

Property Get cstack() As Variant
cstack = stack
End Property

Private Sub Class_Initialize()
ReDim stack(0)
End Sub
